﻿Imports System.Collections.Generic
Imports System.Linq
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.DTO

Namespace DoAnQuanLyBanHang.DAO

    Public Class QuayGiaoDichCtrl
        Private m_QuayGiaoDichData As New QuayGiaoDichData()

        Public Sub HienThiComboBox(cbx As ComboBox)
            cbx.DataSource = m_QuayGiaoDichData.LayQuayGiaoDich()
            cbx.DisplayMember = "TenQuayGiaoDich"
            cbx.ValueMember = "MaQuayGiaoDich"
        End Sub

#Region "Hien thi ComboBox trong DataGridView"
        Public Sub HienThiDataGridViewComboBoxColumn(cmbColumn As DataGridViewComboBoxColumn)
            cmbColumn.DataSource = m_QuayGiaoDichData.LayQuayGiaoDich()
            cmbColumn.DisplayMember = "TenQuayGiaoDich"
            cmbColumn.ValueMember = "MaQuayGiaoDich"
            cmbColumn.DataPropertyName = "MaQuayGiaoDich"
            cmbColumn.HeaderText = "Tên quầy Giao Dịch"
        End Sub
#End Region

        Public Sub HienThi(Dgv As DataGridView, bvn As BindingNavigator)
            Dim bs As New BindingSource()

            bs.DataSource = m_QuayGiaoDichData.LayQuayGiaoDich()
            bvn.BindingSource = bs
            Dgv.DataSource = bs
        End Sub

#Region "Them moi"
        Public Function ThemDongMoi() As DataRow
            Return m_QuayGiaoDichData.ThemDongMoi()
        End Function
        Public Sub ThemMoi(m_Row As DataRow)
            m_QuayGiaoDichData.ThemQuayGiaoDich(m_Row)
        End Sub
#End Region

#Region "Luu"
        Public Function LuuQuayGiaoDich() As Boolean
            Return m_QuayGiaoDichData.LuuQuayGiaoDich()
        End Function
#End Region

    End Class
End Namespace
